package uml.behavioral.interpreter;

import uml.behavioral.interpreter.exception.IllegalInstructionException;

/**
 * 解释器--非终结符表达式<br>
 * on 2022/12/31 0:23
 */
public class SentenceNode extends AbstractNode{
    private AbstractNode direction;
    private AbstractNode action;
    private AbstractNode distance;
    private AbstractNode unit;

    public SentenceNode(AbstractNode direction, AbstractNode action, AbstractNode distance, AbstractNode unit) {
        this.direction = direction;
        this.action = action;
        this.distance = distance;
        this.unit = unit;
    }

    @Override
    public String interpret() throws IllegalInstructionException {
        return direction.interpret()+action.interpret()+distance.interpret()+unit.interpret();
    }
}
